<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../../css/reset.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/add.css"/>
	<link rel="stylesheet" href="../../assets/css/layui.css">
	<link rel="stylesheet" href="../../assets/css/view.css"/>
</head>
<body class="layui-view-body">
<div class="layui-content">
	<div class="layui-row">
		<div class="layui-card">
			<div class="layui-card-header">录入用户</div>
			<form id="form" class="layui-form layui-card-body" onsubmit="">
				<div class="layui-form-item">
					<label class="layui-form-label">昵称</label>
					<div class="layui-input-block">
						<input type="text" name="name" required  lay-verify="required" placeholder="请输入昵称" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">手机号码</label>
					<div class="layui-input-block">
						<input type="text" name="phone" required  lay-verify="required" placeholder="请输入手机号码" autocomplete="off" class="layui-input">

					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-block">
						<input type="text" name="password" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn layui-btn-blue" lay-submit lay-filter="formDemo">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
</div>
<script src="../../assets/layui.all.js"></script>
<script src="/qrcode/jquery2.1.4.js"></script>
<script src="/layer/layer.js"></script>
<script>
	var form = layui.form
			,layer = layui.layer;
</script>
<script>
	$(function () {
		$("#form").submit(function () {
			console.log("开始提交")
			var windowId = layer.load();
			var name = $("input:eq(0)").val();
			var phone = $("input:eq(1)").val();
			var password = $("input:eq(2)").val();
			$.post("/user/insert.do",{
				name:name,
				phone:phone,
				password:password
			},function (data) {
				layer.close(windowId);
				layer.msg(data.result);
				console.log("test")
				if(data.status == 0){
					//录入成功
					console.log("录入成功")
					$("input").val("");
				}else{
					//录入失败

				}
			})
		})
	})
</script>
</body>
</html>
